#!/bin/bash
# weka: run Weka from the command-line
#
# Weka can be obtained from http://www.cs.waikato.ac.nz/ml/weka/downloading.html
# Make sure that WEKAPATH is set to the full path that contains weka.jar in your .bashrc or .zshrc
# The snippets below enable tab completion in Bash and Zsh, respectively.
# 
# Author: Jeroen Janssens (http://jeroenjanssens.com)
#
# See csv2arff and arff2csv for two examples

java -Xmx1024M -cp ${WEKAPATH}/weka.jar "weka.$@"

#########################################################
# Tab completion for Bash                               #
#########################################################
# 
# export WEKAPATH="/home/joe/bin/"
#
# weka-classes () {
# 	unzip -l $WEKAPATH/weka.jar |
# 	sed -rne 's/.*(weka)\/([^g])([^$]*)\.class$/\2\3/p' |
# 	tr '/' '.'
# }
# 
# weka-folders () {
# 	unzip -l $WEKAPATH/weka.jar |
# 	sed -rne 's/.*(weka)\/([^g])([^$]*)\/$/\2\3\./p' |
# 	tr '/' '.'
# }
# 
# _completeweka() {
#   local curw=${COMP_WORDS[COMP_CWORD]}
#   local wordlist=$(weka-folders; weka-classes)
#   COMPREPLY=($(compgen -W '${wordlist[@]}' -- "$curw"))
#   return 0
# }
# 
# complete -o nospace -F _completeweka weka
#
#########################################################
# Tab completion for Zsh                                #
#########################################################
#
# export WEKAJAR="/home/joe/bin/weka.jar"
# 
# weka-classes () {
# 	unzip -l $WEKAJAR |
# 	sed -rne 's/.*(weka)\/([^g])([^$]*)\.class$/\2\3/p' |
# 	tr '/' '.'
# }
# 
# weka-folders () {
# 	unzip -l $WEKAJAR |
# 	sed -rne 's/.*(weka)\/([^g])([^$]*)\/$/\2\3\./p' |
# 	tr '/' '.'
# }
# 
# function _completeweka {
# 	reply=($(weka-folders; weka-classes))
# }
# 
# compctl -K _completeweka weka
#
#########################################################
